import timeTool from "@/utils/time";

// 时间转换计算，刚刚/几分钟前/年月日指令
export const time = {
  mounted(el, binding) {
    const dateTimeString = binding.value;
    if (!dateTimeString) return;
    //计算时间格式
    el.textContent = timeTool.getFormateTime(dateTimeString);
  },
};

// 获取年月日时间指令
export const timeYMD = {
  mounted(el, binding) {
    const dateTimeString = binding.value;
    if (!dateTimeString) return;
    //计算时间格式
    el.textContent = timeTool.getYMD(dateTimeString);
  },
};

// 获取年月日时分时间指令
export const timeYMDHM = {
  mounted(el, binding) {
    const dateTimeString = binding.value;
    if (!dateTimeString) return;
    //计算时间格式
    el.textContent = timeTool.getYMDHM(dateTimeString);
  },
};
